package br.com.academia.controller;

import java.sql.SQLException;
import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import br.com.academia.DAO.TreinoDAO;
import br.com.academia.beans.Treino;
import br.com.academia.util.ConnectionFactory;

@Controller
public class AjaxUtil {
	
	@RequestMapping(value="/populaComboTreinos", method = RequestMethod.GET)
	public @ResponseBody List<Treino> buscaTreinosIdAluno(@RequestParam int idAluno) throws SQLException {
		return new TreinoDAO(new ConnectionFactory().getConnection()).buscaTreinosIdAluno(idAluno);
	}
}
